package com.hc.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hc.domain.Role;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.Set;
import java.util.SortedSet;

@Mapper
public interface RoleMapper extends BaseMapper<Role> {

    @Select("SELECT  tb_role.* FROM  tb_role  INNER JOIN  tb_user_role  ON   tb_role.id = tb_user_role.role_id  INNER JOIN  tb_user  ON   tb_user_role.user_id = tb_user.id WHERE tb_role.status =1 and tb_user.id = #{id}")
    SortedSet<Role> selectRolesByUserId(Integer id);

}
